package src.main.BehavioralPatterns.Strategy;

// 订单处理上下文
public class OrderProcessor {
    private PaymentStrategy paymentStrategy;

    public void processOrder(Double amount) {
        if (paymentStrategy == null) {
            throw new NullPointerException("Payment strategy is null");
        }
        paymentStrategy.pay(amount);
    }

    public void setPaymentStrategy(PaymentStrategy paymentStrategy) {
        this.paymentStrategy = paymentStrategy;
    }
}
